package com.sunnada.edu.business.worker.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sunnada.edu.system.pub.dao.BaseDaoImpl;

@Repository
public  class WorkerDaoImpl extends BaseDaoImpl implements WorkerDao {

	@Override
	public int getWorkerCots(HashMap<String, String> params) {
		List list = selectList("worker_sqlmap.getWorkerCots", params);
		if (list != null && list.size() > 0) {
			String cot = ((Map) list.get(0)).get("COT") + "";
			return Integer.valueOf(cot);
		}
		return 0;
	}

	@Override
	public List<?> findWorkers(HashMap<String, String> params) {
		return selectList("worker_sqlmap.findWorkers", params);
	}
	
	
	@Override
	public int getWorkerProjectCots(HashMap<String, String> params) {
		List list = selectList("worker_sqlmap.getWorkerProjectCots", params);
		if (list != null && list.size() > 0) {
			String cot = ((Map) list.get(0)).get("COT") + "";
			return Integer.valueOf(cot);
		}
		return 0;
	}

	@Override
	public List<?> findWorkerJcqks(HashMap<String, String> params) {
		return selectList("worker_sqlmap.findWorkerJcqks", params);
	}
	
	@Override
	public int getWorkerJcqkCots(HashMap<String, String> params) {
		List list = selectList("worker_sqlmap.getWorkerJcqkCots", params);
		if (list != null && list.size() > 0) {
			String cot = ((Map) list.get(0)).get("COT") + "";
			return Integer.valueOf(cot);
		}
		return 0;
	}
	
	@Override
	public List<?> findWorkerProjects(HashMap<String, String> params) {
		return selectList("worker_sqlmap.findWorkerProjects", params);
	}

	@Override
	public int workerDelete(HashMap<String, String> params) {
		return delete("worker_sqlmap.workerDelete", params);
	}

	@Override
	public int workerAdd(HashMap<String, String> params) {
		return insert("worker_sqlmap.workerAdd", params);
	}
	
	@Override
	public int workerSalaryAdd(HashMap<String, String> params) {
		return insert("worker_sqlmap.workerSalaryAdd", params);
	}

	@Override
	public int workerUpdate(HashMap<String, String> params) {
		return update("worker_sqlmap.workerUpdate", params);
	}
	
	@Override
	public int workerSalaryUpdate(HashMap<String, String> params) {
		return update("worker_sqlmap.workerSalaryUpdate", params);
	}

	@Override
	public Map getWorkerByRecId(HashMap<String, String> params) {
		List list = selectList("worker_sqlmap.getWorkerByRecId", params);
		if (list != null && list.size() > 0) {
			return (Map) list.get(0);
		}
		return null;
	}

	@Override
	public Map<String, String> getWorker(HashMap<String, String> params) {
		List list = selectList("worker_sqlmap.getWorker", params);
		if (list != null && list.size() > 0) {
			return (Map) list.get(0);
		}
		return null;
	}

	@Override
	public int workerPwdReset(HashMap<String, String> params) {
		return update("worker_sqlmap.workerPwdReset", params);
	}

	@Override
	public int workerEnable(HashMap<String, String> params) {
		return update("worker_sqlmap.workerEnable", params);
	}

	@Override
	public int workerDisable(HashMap<String, String> params) {
		return update("worker_sqlmap.workerDisable", params);
	}

	@Override
	public List<?> exportWorker(HashMap<String, String> params) {
		return selectList("worker_sqlmap.exportWorker", params);
	}
	
	@Override
	public int selectWorkerCots(HashMap<String, String> params) {
		List list = selectList("worker_sqlmap.selectWorkerCots", params);
		if (list != null && list.size() > 0) {
			String cot = ((Map) list.get(0)).get("COT") + "";
			return Integer.valueOf(cot);
		}
		return 0;
	}

	@Override
	public List<?> selectWorkers(HashMap<String, String> params) {
		return selectList("worker_sqlmap.selectWorkers", params);
	}

	@Override
	public List<?> getWorkerList(HashMap<String, String> params) {
		return selectList("worker_sqlmap.getWorkerList", params);
	}

}
